<?php
/**
 * Created by PhpStorm.
 * User: D
 * Date: 2019/5/11
 * Time: 10:19
 */
header("Access-Control-Allow-Origin:*");
header("Content-Type:application/json;charset:utf-8");
session_start();
include "dbHelper.php";
if($_SERVER["REQUEST_METHOD"] == 'POST'){
    if((isset($_REQUEST["uname"]) && isset($_REQUEST["upwd"]))){
        $UNAME = $_POST["uname"];
        $UPWD = $_POST["upwd"];

        $sql = "SELECT `u_name`,`u_id`  FROM `useinfo` WHERE `u_name`='" . $UNAME . "'AND`u_pwd`='" . $UPWD . "'";
    }
//    print_r($sql);
    $relust = dbHelper($sql);
//    print_r($relust);

    if ($relust->num_rows >= 1) {
        $userinfo= $relust->fetch_assoc();
        print_r(json_encode(Array("msg" => "登录成功", "status" => 1,"data"=>$userinfo)));
        $_SESSION["useinfo"]=$userinfo;
    } else {
        print_r(json_encode(Array("msg" => "登录失败", "status" => 0)));
    }



} else {
    print_r(json_encode(Array("msg" => "不支持get请求", "status" => -1)));


}














